<!DOCTYPE HTML>
<html>
<head>
  <title>店铺会员卡信息</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link href="css/style.css" rel="stylesheet" type="text/css"  media="all" />
  <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
  <link href="css/slider.css" rel="stylesheet" type="text/css"  media="all" />
  <script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
  <script type="text/javascript" src="js/jquery.nivo.slider.js"></script>
  <script type="text/javascript">
    $(window).load(function() {
        /*获取传递过来的id*/
		var thisURL=document.URL;
		thisURL=thisURL.split("?")[1];
		var id=thisURL.split("=")[1];
		var path="/"+location.pathname.split("/")[1];
        $.post(path+"/S_getImage",function (data) {
            console.log(data);
            $.each(data,function (i,li) {
                console.log(li.imagePath);
                $("#slider").append(
                    '<img src="'+path+"/"+li.imagePath+'" data-thumb="'+path+"/"+li.imagePath+'"  alt="" />'
                );
            });
            $('#slider').nivoSlider();
        },'json');
		var shop;
        /*根据id查询店铺信息*/
        $.get(path+"/S_getClubshop",{"clubId":id},function (date) {
            shop=date;
        },"json");

        /*设置会员卡的有效时间*/
        //得到当前时间
        var date_now = new Date();
        //得到当前年份
        var year = date_now.getFullYear();
        //得到当前月份
        //注：
        //  1：js中获取Date中的month时，会比当前月份少一个月，所以这里需要先加一
        //  2: 判断当前月份是否小于10，如果小于，那么就在月份的前面加一个 '0' ， 如果大于，就显示当前月份
        var month = date_now.getMonth()+1 < 10 ? "0"+(date_now.getMonth()+1) : (date_now.getMonth()+1);
        //得到当前日子（多少号）
        var date = date_now.getDate() < 10 ? "0"+date_now.getDate() : date_now.getDate();

        var begintime=year+"-"+month+"-"+date;
        console.log(begintime);
        /*得到一个月后的时间*/
        var s1 = new Date().getTime();
        var date_now1=new Date(s1+2592000000);
        //得到当前年份
        var year1 = date_now1.getFullYear();
        //得到当前月份
        //注：
        //  1：js中获取Date中的month时，会比当前月份少一个月，所以这里需要先加一
        //  2: 判断当前月份是否小于10，如果小于，那么就在月份的前面加一个 '0' ， 如果大于，就显示当前月份
        var month1 = date_now1.getMonth()+1 < 10 ? "0"+(date_now1.getMonth()+1) : (date_now1.getMonth()+1);
        //得到当前日子（多少号）
        var date1 = date_now1.getDate() < 10 ? "0"+date_now1.getDate() : date_now1.getDate();

        var endtime1=year1+"-"+month1+"-"+date1;
        console.log(endtime1);
        /*得到三个月后的时间*/
        var s3 = new Date().getTime();
        var date_now3=new Date(s3+2592000000*3);
        //得到当前年份
        var year3 = date_now3.getFullYear();
        //得到当前月份
        //注：
        //  1：js中获取Date中的month时，会比当前月份少一个月，所以这里需要先加一
        //  2: 判断当前月份是否小于10，如果小于，那么就在月份的前面加一个 '0' ， 如果大于，就显示当前月份
        var month3 = date_now3.getMonth()+1 < 10 ? "0"+(date_now3.getMonth()+1) : (date_now3.getMonth()+1);
        //得到当前日子（多少号）
        var date3 = date_now3.getDate() < 10 ? "0"+date_now3.getDate() : date_now3.getDate();

        var endtime3=year3+"-"+month3+"-"+date3;
        console.log(endtime3);
        /*得到一年后的时间*/

        var endtime12=year+1+"-"+month+"-"+date;
        console.log(endtime12)
        /*根据id查询该店铺下的会员卡*/
		$.get(path+"/S_getVipCardByClubId",{"clubId":id},function (date) {
            var userclub;
            $.each(date,function (i,obj) {
                if(obj.membclassify==0){
                    userclub="通用";
                }
                if(obj.membclassify==1){
                    userclub="本馆";
                }
                var endtime;
                /*判断卡类型*/
				if(obj.membertype=="年卡"){
					endtime=endtime12;
				}
                if(obj.membertype=="季卡"){
                    endtime=endtime3;
                }
                if(obj.membertype=="月卡"){
                    endtime=endtime1;
                }
                console.log(obj);
                var url=path+"/S_addVipCard?vipcardCardId="+obj.memberid+"&vipcardName="+obj.membername+"&vipcardCategary="+obj.membertype+"&vipcardBegintime="+begintime+"&vipcardEndtime="+endtime+"&vipcardBossid="+obj.clubClubId+"&vipcardClubId="+shop.shopid+"&vipcardClub="+obj.membclassify+"&vipcardImg="+obj.memberimg;
                $("#vipcard").append(
                    '<div class="grid_1_of_3 images_1_of_3 top_grid" style="margin-top: 0px;margin-left: 0px;margin-right: 10px">'+
                    '<h3>'+shop.shopname+'</h3>'+
                    '<img src="/SWT/'+obj.memberimg+'" alt=""style="width: 400px;height: 230px"/>'+
                    '<span>卡名称</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>'+obj.membername+'</span><br>'+
                    '<span>卡类型</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>'+obj.membertype+'</span><br>'+
                    '<span>价格</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>'+obj.memberprice+'</span><br>'+
                    '<span>适用场馆</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>'+userclub+'</span><br>'+
                    '<div class="button" onclick="addVipCard(this)"><span><a href='+url+'>申请</a></span></div>'+
                    '</div>'
                );
            });
        },"json");

    });
    </script>
 </head>
<body>
	<!----start-header----->
	<!---start-top-nav---->
	 <div class="header">
	     <div class="wrap">
	     <!---start-top-nav---->
			<div class="top-header">
				<div class="clear"> </div>
			</div>
			<!---start-top-nav---->
			<div class="top-nav">
				<div class="top-nav-left">
					<ul>
						<li><a href="person.html">个人信息</a></li>
						<li><a href="index.html">约个课</a></li>
						<li ><a href="personal.html">约私教</a></li>
						<li><a href="info.html">预约信息</a></li>
						<li><a href="club.html">场馆信息</a></li>
						<li ><a href="vipcard.html">我的会员卡</a></li>
						<div class="clear"> </div>
					</ul>
				</div>
				<div class="top-nav-right">
					<div class="telephone">
						<span><i class="phone_img"><img src="images/phone.png" alt="" /></i> CALL</span><span class="number">(800) 234-5678</span>
					</div>
				</div>
				<div class="clear"> </div>
			</div>
			<!---End-top-nav---->
		</div>
	</div>
   <!----End-header----->
	       <!------ Slider ------------>
		     <div class="slider">
	      	  <div class="slider-wrapper theme-default">
	            <div id="slider" class="nivoSlider">
	            </div>
	        </div>
   	    </div>
		<!------End Slider ------------>
		 <!---start-content---->
		 <div class="wrap">
		   <div class="content">	 	 
		       <div class="top-grids">
			 		<div class="section group" id="vipcard">
						<!--<div class="grid_1_of_3 images_1_of_3 top_grid" style="margin-top: 0px;margin-left: 0px;margin-right: 10px">
							<h3>店铺名</h3>
							  <img src="images/welcome_img2.jpg" alt="" />
						      <span>卡类型</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>季卡</span><br>
						      <span>状态</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>使用中</span><br>
						      <span>到期时间</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>2018-11-28</span><br>
						      <span>适用场馆</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>青云</span>
							<form>
								<input type="text" value="" name="vipcardUserId" hidden>
								<input type="text" value="" name="vipcardCardId" hidden>
								<input type="text" value="" name="vipcardName" hidden>
								<input type="text" value="" name="vipcardCategory" hidden>
								<input type="text" value="" name="vipcardDate" hidden>
								<input type="text" value="" name="vipcardCourse" hidden>
								<input type="text" value="" name="vipcardClubId" hidden>
								<div class="button"><span><a href="#">申请</a></span></div>
							</form>
						</div>-->
					</div>
		 		</div>
			 	</div>		   			
		 <!---End-content---->
	</body>
</html>

